package com.maxmlr.net.rpc;

import com.google.protobuf.ByteString;
import com.google.protobuf.Value;

import java.util.List;

/**
 * @ClassName TcpServer
 * @Description TODO
 * @Author maxiao
 * @Date 2020/4/4 下午6:03
 * @Version V1.0
 */
public class Test1 {

    public static void main(String[] args) {
        Value value = Value.newBuilder().setStringValue("3333").build();

        Rpc.RpcRequest rpcRequest = Rpc.RpcRequest.newBuilder()
                .addArgs(value)
                .addArgs(Value.newBuilder().setNumberValue(1235).build())
                .setServiceName("111")
                .setMethodName("2222")
                .build();

        ByteString bytes = rpcRequest.toByteString();

        System.out.println(bytes.toStringUtf8());

        System.out.println(rpcRequest);

        inkov(rpcRequest);

    }

    public static void inkov(Rpc.RpcRequest rpcRequest){

        List<Value> valuesList = rpcRequest.getArgsList();

        valuesList.forEach(value -> System.out.println(value));

    }


}
